Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamic list of posts completed #1188

Closed
wants to merge 2 commits into from

Conversation

MaksymMohyla
Copy link

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Thank you for your hard work on this pull request! While your code is generally well-structured and meets many of the task requirements, there are a few critical issues that need to be addressed before we can proceed:

  1. Error Handling for Comment Deletion: The task requires handling errors for comment deletion so users can retry. This is a core requirement that is currently missing.

  2. Incorrect Prop Name: The typo in selestedPost should be corrected to selectedPost across multiple files to ensure the code functions correctly.

  3. Missing Error Handling for Adding Comments: Similar to comment deletion, error handling for adding comments is required to allow users to retry in case of failure.

  4. Test Coverage: Ensure that tests cover scenarios for retrying comment addition and deletion upon failure, as this is part of the task requirements.

Please address these issues to ensure the functionality aligns with the task requirements. Once these are resolved, we can move forward with the approval. Keep up the great work! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review button in the Reviewers tab.

@@ -262,7 +291,7 @@ describe('', () => {
});

it('should not have users hardcoded', () => {
cy.intercept('**/users', { fixture: 'someUsers' })
cy.intercept('**/users', { fixture: 'someUsers' });

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cy.intercept call should be followed by .as('someUsersRequest') to ensure the request can be waited on or asserted later in the test.

@@ -396,7 +425,7 @@
});

it('should show posts loader while waiting for API response', () => {
page.mockUser1Posts()
page.mockUser1Posts();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The page.mockUser1Posts() call should be followed by .as('user1PostsRequest') to ensure consistency with other mock calls.

@@ -421,7 +450,7 @@
describe('if posts are loaded successfully', () => {
beforeEach(() => {
page.mockUsers();
page.mockUser1Posts()
page.mockUser1Posts();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the previous point, the page.mockUser1Posts() call should be followed by .as('user1PostsRequest').

@@ -455,7 +484,7 @@
describe('on posts loading error', () => {
beforeEach(() => {
page.mockUsers();
page.mockError('**/posts?userId=1', 'user1PostsRequest')
page.mockError('**/posts?userId=1', 'user1PostsRequest');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The page.mockError call should be followed by .as('user1PostsRequest') to ensure the request can be waited on or asserted later in the test.

@@ -509,7 +538,7 @@
describe('if the other user is selected', () => {
beforeEach(() => {
page.mockUsers();
page.mockUser1Posts()
page.mockUser1Posts();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The page.mockUser1Posts() call should be followed by .as('user1PostsRequest').

return (
<div className="content" data-cy="PostDetails">
<div className="content" data-cy="PostDetails">
<div className="block">
<h2 data-cy="PostTitle">
#18: voluptate et itaque vero tempora molestiae
#{selestedPost.id}: {selestedPost.title}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The typo in selestedPost should be corrected to selectedPost to match the prop name.

eveniet quo quis laborum totam consequatur non dolor ut et est
repudiandae est voluptatem vel debitis et magnam
</p>
<p data-cy="PostBody">{selestedPost.body}</p>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The typo in selestedPost should be corrected to selectedPost to match the prop name.

<NewCommentForm
setComments={setComments}
setHasError={setHasError}
post={selestedPost}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The typo in selestedPost should be corrected to selectedPost to match the prop name.

@@ -9,8 +27,14 @@ export const UserSelector: React.FC = () => {
className="button"
aria-haspopup="true"
aria-controls="dropdown-menu"
onClick={() => setShowUserList(!showUserList)}
onBlur={() => setTimeout(() => setShowUserList(!showUserList), 200)}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The onBlur event handler uses a setTimeout to toggle the user list visibility. This approach might cause unexpected behavior if the user interacts with the dropdown quickly. Consider using a more reliable method to handle dropdown visibility, such as managing focus events more precisely.

@@ -26,7 +24,7 @@ function request<T>(
};
}

// for a demo purpose we emulate a delay to see if Loaders work
// should be 300

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment 'should be 300' is unclear. It might refer to the delay in the wait function, but it's not explicit. Consider clarifying the comment to indicate its purpose or remove it if it's unnecessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants